from tensorflow.keras.models import load_model
from utils.data_generator import test_generator, pred_generator
from utils.image_plot import plot_images

#取测试集
test_gen = test_generator(
    data_dir='../data/imagenette2-160/test',
    target_size=(64, 64),
    batch_size=32,
    class_mode='categorical',
)


"""
pred_gen = pred_generator(
    data_dir='../dataset/natural_scenes/seg_pre',
    target_size=(64, 64),
    batch_size=32,
    class_mode=None,
)
"""


#
model_path = '../models/model-2020-08-21-21-24-22'

loaded_model = load_model(filepath=model_path)

#模型验证测试集

loss, accuracy = loaded_model.evaluate(x = test_gen)

#获取batch size的预测
#pred_batch = pred_gen.next()
#pred_result = loaded_model.predict(x = pred_batch)

#plot_images(pred_batch, pred_result)

